Autogenerated HTML docs for v1.8.1-rc2-5-g252f9
diff --git a/git-rebase.html b/git-rebase.html index 3de9e73..2e5d78b 100644 --- a/git-rebase.html +++ b/git-rebase.html
@@ -2,15 +2,25 @@ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<meta name="generator" content="AsciiDoc 8.5.2" /> +<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> +<meta name="generator" content="AsciiDoc 8.6.8" /> <title>git-rebase(1)</title> <style type="text/css"> -/* Debug borders */ -p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { -/* - border: 1px solid red; -*/ +/* Shared CSS for AsciiDoc xhtml11 and html5 backends */ + +/* Default font. */ +body { + font-family: Georgia,serif; +} + +/* Title font. */ +h1, h2, h3, h4, h5, h6, +div.title, caption.title, +thead, p.table.header, +#toctitle, +#author, #revnumber, #revdate, #revremark, +#footer { + font-family: Arial,Helvetica,sans-serif; } body { @@ -35,13 +45,8 @@ color: #083194; } -tt { - color: navy; -} - h1, h2, h3, h4, h5, h6 { color: #527bbd; - font-family: sans-serif; margin-top: 1.2em; margin-bottom: 0.5em; line-height: 1.3; @@ -59,9 +64,11 @@ h3 + * { clear: left; } +h5 { + font-size: 1.0em; +} div.sectionbody { - font-family: serif; margin-left: 0; } @@ -77,45 +84,48 @@ ul, ol, li > p { margin-top: 0; } +ul > li { color: #aaa; } +ul > li > * { color: black; } -pre { +.monospaced, code, pre { + font-family: "Courier New", Courier, monospace; + font-size: inherit; + color: navy; padding: 0; margin: 0; } -span#author { + +#author { color: #527bbd; - font-family: sans-serif; font-weight: bold; font-size: 1.1em; } -span#email { +#email { } -span#revnumber, span#revdate, span#revremark { - font-family: sans-serif; +#revnumber, #revdate, #revremark { } -div#footer { - font-family: sans-serif; +#footer { font-size: small; border-top: 2px solid silver; padding-top: 0.5em; margin-top: 4.0em; } -div#footer-text { +#footer-text { float: left; padding-bottom: 0.5em; } -div#footer-badges { +#footer-badges { float: right; padding-bottom: 0.5em; } -div#preamble { +#preamble { margin-top: 1.5em; margin-bottom: 1.5em; } -div.tableblock, div.imageblock, div.exampleblock, div.verseblock, +div.imageblock, div.exampleblock, div.verseblock, div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, div.admonitionblock { margin-top: 1.0em; @@ -135,7 +145,6 @@ /* Block element titles. */ div.title, caption.title { color: #527bbd; - font-family: sans-serif; font-weight: bold; text-align: left; margin-top: 1.0em; @@ -157,13 +166,15 @@ div.sidebarblock > div.content { background: #ffffee; - border: 1px solid silver; + border: 1px solid #dddddd; + border-left: 4px solid #f0f0f0; padding: 0.5em; } div.listingblock > div.content { - border: 1px solid silver; - background: #f4f4f4; + border: 1px solid #dddddd; + border-left: 5px solid #f0f0f0; + background: #f8f8f8; padding: 0.5em; } @@ -171,8 +182,8 @@ padding-left: 1.0em; margin-left: 1.0em; margin-right: 10%; - border-left: 5px solid #dddddd; - color: #777777; + border-left: 5px solid #f0f0f0; + color: #888; } div.quoteblock > div.attribution { @@ -180,8 +191,9 @@ text-align: right; } -div.verseblock > div.content { - white-space: pre; +div.verseblock > pre.content { + font-family: inherit; + font-size: inherit; } div.verseblock > div.attribution { padding-top: 0.75em; @@ -254,35 +266,12 @@ margin-bottom: 0.1em; } -div.tableblock > table { - border: 3px solid #527bbd; -} -thead, p.table.header { - font-family: sans-serif; - font-weight: bold; -} tfoot { font-weight: bold; } td > div.verse { white-space: pre; } -p.table { - margin-top: 0; -} -/* Because the table frame attribute is overriden by CSS in most browsers. */ -div.tableblock > table[frame="void"] { - border-style: none; -} -div.tableblock > table[frame="hsides"] { - border-left-style: none; - border-right-style: none; -} -div.tableblock > table[frame="vsides"] { - border-top-style: none; - border-bottom-style: none; -} - div.hdlist { margin-top: 0.8em; @@ -339,25 +328,32 @@ min-width: 100px; } - -@media print { - div#footer-badges { display: none; } +div.colist td { + padding-right: 0.5em; + padding-bottom: 0.3em; + vertical-align: top; +} +div.colist td img { + margin-top: 0.3em; } -div#toc { +@media print { + #footer-badges { display: none; } +} + +#toc { margin-bottom: 2.5em; } -div#toctitle { +#toctitle { color: #527bbd; - font-family: sans-serif; font-size: 1.1em; font-weight: bold; margin-top: 1.0em; margin-bottom: 0.1em; } -div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { +div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { margin-top: 0; margin-bottom: 0; } @@ -373,69 +369,173 @@ margin-left: 6em; font-size: 0.9em; } -/* Overrides for manpage documents */ -h1 { + +span.aqua { color: aqua; } +span.black { color: black; } +span.blue { color: blue; } +span.fuchsia { color: fuchsia; } +span.gray { color: gray; } +span.green { color: green; } +span.lime { color: lime; } +span.maroon { color: maroon; } +span.navy { color: navy; } +span.olive { color: olive; } +span.purple { color: purple; } +span.red { color: red; } +span.silver { color: silver; } +span.teal { color: teal; } +span.white { color: white; } +span.yellow { color: yellow; } + +span.aqua-background { background: aqua; } +span.black-background { background: black; } +span.blue-background { background: blue; } +span.fuchsia-background { background: fuchsia; } +span.gray-background { background: gray; } +span.green-background { background: green; } +span.lime-background { background: lime; } +span.maroon-background { background: maroon; } +span.navy-background { background: navy; } +span.olive-background { background: olive; } +span.purple-background { background: purple; } +span.red-background { background: red; } +span.silver-background { background: silver; } +span.teal-background { background: teal; } +span.white-background { background: white; } +span.yellow-background { background: yellow; } + +span.big { font-size: 2em; } +span.small { font-size: 0.6em; } + +span.underline { text-decoration: underline; } +span.overline { text-decoration: overline; } +span.line-through { text-decoration: line-through; } + +div.unbreakable { page-break-inside: avoid; } + + +/* + * xhtml11 specific + * + * */ + +div.tableblock { + margin-top: 1.0em; + margin-bottom: 1.5em; +} +div.tableblock > table { + border: 3px solid #527bbd; +} +thead, p.table.header { + font-weight: bold; + color: #527bbd; +} +p.table { + margin-top: 0; +} +/* Because the table frame attribute is overriden by CSS in most browsers. */ +div.tableblock > table[frame="void"] { + border-style: none; +} +div.tableblock > table[frame="hsides"] { + border-left-style: none; + border-right-style: none; +} +div.tableblock > table[frame="vsides"] { + border-top-style: none; + border-bottom-style: none; +} + + +/* + * html5 specific + * + * */ + +table.tableblock { + margin-top: 1.0em; + margin-bottom: 1.5em; +} +thead, p.tableblock.header { + font-weight: bold; + color: #527bbd; +} +p.tableblock { + margin-top: 0; +} +table.tableblock { + border-width: 3px; + border-spacing: 0px; + border-style: solid; + border-color: #527bbd; + border-collapse: collapse; +} +th.tableblock, td.tableblock { + border-width: 1px; + padding: 4px; + border-style: solid; + border-color: #527bbd; +} + +table.tableblock.frame-topbot { + border-left-style: hidden; + border-right-style: hidden; +} +table.tableblock.frame-sides { + border-top-style: hidden; + border-bottom-style: hidden; +} +table.tableblock.frame-none { + border-style: hidden; +} + +th.tableblock.halign-left, td.tableblock.halign-left { + text-align: left; +} +th.tableblock.halign-center, td.tableblock.halign-center { + text-align: center; +} +th.tableblock.halign-right, td.tableblock.halign-right { + text-align: right; +} + +th.tableblock.valign-top, td.tableblock.valign-top { + vertical-align: top; +} +th.tableblock.valign-middle, td.tableblock.valign-middle { + vertical-align: middle; +} +th.tableblock.valign-bottom, td.tableblock.valign-bottom { + vertical-align: bottom; +} + + +/* + * manpage specific + * + * */ + +body.manpage h1 { padding-top: 0.5em; padding-bottom: 0.5em; border-top: 2px solid silver; border-bottom: 2px solid silver; } -h2 { +body.manpage h2 { border-style: none; } -div.sectionbody { - margin-left: 5%; +body.manpage div.sectionbody { + margin-left: 3em; } @media print { - div#toc { display: none; } + body.manpage div#toc { display: none; } } -/* Workarounds for IE6's broken and incomplete CSS2. */ -div.sidebar-content { - background: #ffffee; - border: 1px solid silver; - padding: 0.5em; -} -div.sidebar-title, div.image-title { - color: #527bbd; - font-family: sans-serif; - font-weight: bold; - margin-top: 0.0em; - margin-bottom: 0.5em; -} - -div.listingblock div.content { - border: 1px solid silver; - background: #f4f4f4; - padding: 0.5em; -} - -div.quoteblock-attribution { - padding-top: 0.5em; - text-align: right; -} - -div.verseblock-content { - white-space: pre; -} -div.verseblock-attribution { - padding-top: 0.75em; - text-align: left; -} - -div.exampleblock-content { - border-left: 3px solid #dddddd; - padding-left: 0.5em; -} - -/* IE6 sets dynamically generated links as visited. */ -div#toc a:visited { color: blue; } </style> <script type="text/javascript"> /*<+'])'); + var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); // Function that scans the DOM tree for header elements (the DOM2 // nodeIterator API would be a better technique but not supported by all // browsers). @@ -497,6 +597,25 @@ } var toc = document.getElementById("toc"); + if (!toc) { + return; + } + + // Delete existing TOC entries in case we're reloading the TOC. + var tocEntriesToRemove = []; + var i; + for (i = 0; i < toc.childNodes.length; i++) { + var entry = toc.childNodes[i]; + if (entry.nodeName.toLowerCase() == 'div' + && entry.getAttribute("class") + && entry.getAttribute("class").match(/^toclevel/)) + tocEntriesToRemove.push(entry); + } + for (i = 0; i < tocEntriesToRemove.length; i++) { + toc.removeChild(tocEntriesToRemove[i]); + } + + // Rebuild TOC entries. var entries = tocEntries(document.getElementById("content"), toclevels); for (var i = 0; i < entries.length; ++i) { var entry = entries[i]; @@ -524,24 +643,44 @@ */ footnotes: function () { - var cont = document.getElementById("content"); + // Delete existing footnote entries in case we're reloading the footnodes. + var i; var noteholder = document.getElementById("footnotes"); + if (!noteholder) { + return; + } + var entriesToRemove = []; + for (i = 0; i < noteholder.childNodes.length; i++) { + var entry = noteholder.childNodes[i]; + if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") + entriesToRemove.push(entry); + } + for (i = 0; i < entriesToRemove.length; i++) { + noteholder.removeChild(entriesToRemove[i]); + } + + // Rebuild footnote entries. + var cont = document.getElementById("content"); var spans = cont.getElementsByTagName("span"); var refs = {}; var n = 0; for (i=0; i<spans.length; i++) { if (spans[i].className == "footnote") { n++; - // Use [\s\S] in place of . so multi-line matches work. - // Because JavaScript has no s (dotall) regex flag. - note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; + var note = spans[i].getAttribute("data-note"); + if (!note) { + // Use [\s\S] in place of . so multi-line matches work. + // Because JavaScript has no s (dotall) regex flag. + note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; + spans[i].innerHTML = + "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + + "' title='View footnote' class='footnote'>" + n + "</a>]"; + spans[i].setAttribute("data-note", note); + } noteholder.innerHTML += "<div class='footnote' id='_footnote_" + n + "'>" + "<a href='#_footnoteref_" + n + "' title='Return to text'>" + n + "</a>. " + note + "</div>"; - spans[i].innerHTML = - "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + - "' title='View footnote' class='footnote'>" + n + "</a>]"; var id =spans[i].getAttribute("id"); if (id != null) refs["#"+id] = n; } @@ -561,13 +700,36 @@ } } } +}, + +install: function(toclevels) { + var timerId; + + function reinstall() { + asciidoc.footnotes(); + if (toclevels) { + asciidoc.toc(toclevels); + } + } + + function reinstallAndRemoveTimer() { + clearInterval(timerId); + reinstall(); + } + + timerId = setInterval(reinstall, 500); + if (document.addEventListener) + document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); + else + window.onload = reinstallAndRemoveTimer; } } +asciidoc.install(); /*]]>*/ </script> </head> -<body> +<body class="manpage"> <div id="header"> <h1> git-rebase(1) Manual Page @@ -580,21 +742,24 @@ </div> </div> <div id="content"> +<div class="sect1"> <h2 id="_synopsis">SYNOPSIS</h2> <div class="sectionbody"> <div class="verseblock"> -<div class="verseblock-content"><em>git rebase</em> [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>] +<pre class="content"><em>git rebase</em> [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>] <em>git rebase</em> [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>] -<em>git rebase</em> --continue | --skip | --abort | --edit-todo</div> -<div class="verseblock-attribution"> +<em>git rebase</em> --continue | --skip | --abort | --edit-todo</pre> +<div class="attribution"> </div></div> </div> +</div> +<div class="sect1"> <h2 id="_description">DESCRIPTION</h2> <div class="sectionbody"> <div class="paragraph"><p>If <branch> is specified, <em>git rebase</em> will perform an automatic -<tt>git checkout <branch></tt> before doing anything else. Otherwise +<code>git checkout <branch></code> before doing anything else. Otherwise it remains on the current branch.</p></div> <div class="paragraph"><p>If <upstream> is not specified, the upstream configured in branch.<name>.remote and branch.<name>.merge options will be used; see @@ -603,11 +768,11 @@ the rebase will abort.</p></div> <div class="paragraph"><p>All changes made by commits in the current branch but that are not in <upstream> are saved to a temporary area. This is the same set -of commits that would be shown by <tt>git log <upstream>..HEAD</tt> (or -<tt>git log HEAD</tt>, if --root is specified).</p></div> +of commits that would be shown by <code>git log <upstream>..HEAD</code> (or +<code>git log HEAD</code>, if --root is specified).</p></div> <div class="paragraph"><p>The current branch is reset to <upstream>, or <newbase> if the --onto option was supplied. This has the exact same effect as -<tt>git reset --hard <upstream></tt> (or <newbase>). ORIG_HEAD is set +<code>git reset --hard <upstream></code> (or <newbase>). ORIG_HEAD is set to point at the tip of the branch before the reset.</p></div> <div class="paragraph"><p>The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order. Note that @@ -616,32 +781,32 @@ with a different commit message or timestamp will be skipped).</p></div> <div class="paragraph"><p>It is possible that a merge failure will prevent this process from being completely automatic. You will have to resolve any such merge failure -and run <tt>git rebase --continue</tt>. Another option is to bypass the commit -that caused the merge failure with <tt>git rebase --skip</tt>. To check out the +and run <code>git rebase --continue</code>. Another option is to bypass the commit +that caused the merge failure with <code>git rebase --skip</code>. To check out the original <branch> and remove the .git/rebase-apply working files, use the -command <tt>git rebase --abort</tt> instead.</p></div> +command <code>git rebase --abort</code> instead.</p></div> <div class="paragraph"><p>Assume the following history exists and the current branch is "topic":</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> A---B---C topic +<pre><code> A---B---C topic / - D---E---F---G master</tt></pre> + D---E---F---G master</code></pre> </div></div> <div class="paragraph"><p>From this point, the result of either of the following commands:</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase master -git rebase master topic</tt></pre> +<pre><code>git rebase master +git rebase master topic</code></pre> </div></div> <div class="paragraph"><p>would be:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> A'--B'--C' topic +<pre><code> A'--B'--C' topic / - D---E---F---G master</tt></pre> + D---E---F---G master</code></pre> </div></div> -<div class="paragraph"><p><strong>NOTE:</strong> The latter form is just a short-hand of <tt>git checkout topic</tt> -followed by <tt>git rebase master</tt>. When rebase exits <tt>topic</tt> will +<div class="paragraph"><p><strong>NOTE:</strong> The latter form is just a short-hand of <code>git checkout topic</code> +followed by <code>git rebase master</code>. When rebase exits <code>topic</code> will remain the checked-out branch.</p></div> <div class="paragraph"><p>If the upstream branch already contains a change you have made (e.g., because you mailed a patch which was applied upstream), then that commit @@ -650,87 +815,87 @@ but have different committer information):</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> A---B---C topic +<pre><code> A---B---C topic / - D---E---A'---F master</tt></pre> + D---E---A'---F master</code></pre> </div></div> <div class="paragraph"><p>will result in:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> B'---C' topic +<pre><code> B'---C' topic / - D---E---A'---F master</tt></pre> + D---E---A'---F master</code></pre> </div></div> <div class="paragraph"><p>Here is how you would transplant a topic branch based on one branch to another, to pretend that you forked the topic branch -from the latter branch, using <tt>rebase --onto</tt>.</p></div> +from the latter branch, using <code>rebase --onto</code>.</p></div> <div class="paragraph"><p>First let’s assume your <em>topic</em> is based on branch <em>next</em>. For example, a feature developed in <em>topic</em> depends on some functionality which is found in <em>next</em>.</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> o---o---o---o---o master +<pre><code> o---o---o---o---o master \ o---o---o---o---o next \ - o---o---o topic</tt></pre> + o---o---o topic</code></pre> </div></div> <div class="paragraph"><p>We want to make <em>topic</em> forked from branch <em>master</em>; for example, because the functionality on which <em>topic</em> depends was merged into the more stable <em>master</em> branch. We want our tree to look like this:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> o---o---o---o---o master +<pre><code> o---o---o---o---o master | \ | o'--o'--o' topic \ - o---o---o---o---o next</tt></pre> + o---o---o---o---o next</code></pre> </div></div> <div class="paragraph"><p>We can get this using the following command:</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase --onto master next topic</tt></pre> +<pre><code>git rebase --onto master next topic</code></pre> </div></div> <div class="paragraph"><p>Another example of --onto option is to rebase part of a branch. If we have the following situation:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> H---I---J topicB +<pre><code> H---I---J topicB / E---F---G topicA / - A---B---C---D master</tt></pre> + A---B---C---D master</code></pre> </div></div> <div class="paragraph"><p>then the command</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase --onto master topicA topicB</tt></pre> +<pre><code>git rebase --onto master topicA topicB</code></pre> </div></div> <div class="paragraph"><p>would result in:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> H'--I'--J' topicB +<pre><code> H'--I'--J' topicB / | E---F---G topicA |/ - A---B---C---D master</tt></pre> + A---B---C---D master</code></pre> </div></div> <div class="paragraph"><p>This is useful when topicB does not depend on topicA.</p></div> <div class="paragraph"><p>A range of commits could also be removed with rebase. If we have the following situation:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> E---F---G---H---I---J topicA</tt></pre> +<pre><code> E---F---G---H---I---J topicA</code></pre> </div></div> <div class="paragraph"><p>then the command</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase --onto topicA~5 topicA~3 topicA</tt></pre> +<pre><code>git rebase --onto topicA~5 topicA~3 topicA</code></pre> </div></div> <div class="paragraph"><p>would result in the removal of commits F and G:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> E---H'---I'---J' topicA</tt></pre> +<pre><code> E---H'---I'---J' topicA</code></pre> </div></div> <div class="paragraph"><p>This is useful if F and G were flawed in some way, or should not be part of topicA. Note that the argument to --onto and the <upstream> @@ -742,20 +907,22 @@ typically this would be done with</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git add <filename></tt></pre> +<pre><code>git add <filename></code></pre> </div></div> <div class="paragraph"><p>After resolving the conflict manually and updating the index with the desired resolution, you can continue the rebasing process with</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase --continue</tt></pre> +<pre><code>git rebase --continue</code></pre> </div></div> <div class="paragraph"><p>Alternatively, you can undo the <em>git rebase</em> with</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase --abort</tt></pre> +<pre><code>git rebase --abort</code></pre> </div></div> </div> +</div> +<div class="sect1"> <h2 id="_configuration">CONFIGURATION</h2> <div class="sectionbody"> <div class="dlist"><dl> @@ -778,6 +945,8 @@ </dd> </dl></div> </div> +</div> +<div class="sect1"> <h2 id="_options">OPTIONS</h2> <div class="sectionbody"> <div class="dlist"><dl> @@ -885,7 +1054,7 @@ <dd> <p> Use the given merge strategy. - If there is no <tt>-s</tt> option <em>git merge-recursive</em> is used + If there is no <code>-s</code> option <em>git merge-recursive</em> is used instead. This implies --merge. </p> <div class="paragraph"><p>Because <em>git rebase</em> replays each commit from the working branch @@ -902,9 +1071,9 @@ <dd> <p> Pass the <strategy-option> through to the merge strategy. - This implies <tt>--merge</tt> and, if no strategy has been - specified, <tt>-s recursive</tt>. Note the reversal of <em>ours</em> and - <em>theirs</em> as noted above for the <tt>-m</tt> option. + This implies <code>--merge</code> and, if no strategy has been + specified, <code>-s recursive</code>. Note the reversal of <em>ours</em> and + <em>theirs</em> as noted above for the <code>-m</code> option. </p> </dd> <dt class="hdlist1"> @@ -1046,8 +1215,8 @@ <p> Instead of ignoring merges, try to recreate them. </p> -<div class="paragraph"><p>This uses the <tt>--interactive</tt> machinery internally, but combining it -with the <tt>--interactive</tt> option explicitly is generally not a good +<div class="paragraph"><p>This uses the <code>--interactive</code> machinery internally, but combining it +with the <code>--interactive</code> option explicitly is generally not a good idea unless you know what you are doing (see BUGS below).</p></div> </dd> <dt class="hdlist1"> @@ -1062,20 +1231,20 @@ final history. <cmd> will be interpreted as one or more shell commands. </p> -<div class="paragraph"><p>This option can only be used with the <tt>--interactive</tt> option +<div class="paragraph"><p>This option can only be used with the <code>--interactive</code> option (see INTERACTIVE MODE below).</p></div> -<div class="paragraph"><p>You may execute several commands by either using one instance of <tt>--exec</tt> +<div class="paragraph"><p>You may execute several commands by either using one instance of <code>--exec</code> with several commands:</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase -i --exec "cmd1 && cmd2 && ..."</tt></pre> +<pre><code>git rebase -i --exec "cmd1 && cmd2 && ..."</code></pre> </div></div> -<div class="paragraph"><p>or by giving more than one <tt>--exec</tt>:</p></div> +<div class="paragraph"><p>or by giving more than one <code>--exec</code>:</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase -i --exec "cmd1" --exec "cmd2" --exec ...</tt></pre> +<pre><code>git rebase -i --exec "cmd1" --exec "cmd2" --exec ...</code></pre> </div></div> -<div class="paragraph"><p>If <tt>--autosquash</tt> is used, "exec" lines will not be appended for +<div class="paragraph"><p>If <code>--autosquash</code> is used, "exec" lines will not be appended for the intermediate commits, and will only appear at the end of each squash/fixup series.</p></div> </dd> @@ -1107,11 +1276,11 @@ the same …, automatically modify the todo list of rebase -i so that the commit marked for squashing comes right after the commit to be modified, and change the action of the moved - commit from <tt>pick</tt> to <tt>squash</tt> (or <tt>fixup</tt>). + commit from <code>pick</code> to <code>squash</code> (or <code>fixup</code>). </p> <div class="paragraph"><p>This option is only valid when the <em>--interactive</em> option is used.</p></div> <div class="paragraph"><p>If the <em>--autosquash</em> option is enabled by default using the -configuration variable <tt>rebase.autosquash</tt>, this option can be +configuration variable <code>rebase.autosquash</code>, this option can be used to override and disable this setting.</p></div> </dd> <dt class="hdlist1"> @@ -1131,11 +1300,13 @@ </dd> </dl></div> </div> +</div> +<div class="sect1"> <h2 id="_merge_strategies">MERGE STRATEGIES</h2> <div class="sectionbody"> <div class="paragraph"><p>The merge mechanism (<em>git-merge</em> and <em>git-pull</em> commands) allows the -backend <em>merge strategies</em> to be chosen with <tt>-s</tt> option. Some strategies -can also take their own options, which can be passed by giving <tt>-X<option></tt> +backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies +can also take their own options, which can be passed by giving <code>-X<option></code> arguments to <em>git-merge</em> and/or <em>git-pull</em>.</p></div> <div class="dlist"><dl> <dt class="hdlist1"> @@ -1200,7 +1371,7 @@ to avoid mismerges that sometimes occur due to unimportant matching lines (e.g., braces from distinct functions). Use this when the branches to be merged have diverged wildly. - See also <a href="git-diff.html">git-diff(1)</a> <tt>--patience</tt>. + See also <a href="git-diff.html">git-diff(1)</a> <code>--patience</code>. </p> </dd> <dt class="hdlist1"> @@ -1217,8 +1388,8 @@ Treats lines with the indicated type of whitespace change as unchanged for the sake of a three-way merge. Whitespace changes mixed with other changes to a line are not ignored. - See also <a href="git-diff.html">git-diff(1)</a> <tt>-b</tt>, <tt>-w</tt>, and - <tt>--ignore-space-at-eol</tt>. + See also <a href="git-diff.html">git-diff(1)</a> <code>-b</code>, <code>-w</code>, and + <code>--ignore-space-at-eol</code>. </p> <div class="ulist"><ul> <li> @@ -1258,8 +1429,8 @@ </dt> <dd> <p> - Disables the <tt>renormalize</tt> option. This overrides the - <tt>merge.renormalize</tt> configuration variable. + Disables the <code>renormalize</code> option. This overrides the + <code>merge.renormalize</code> configuration variable. </p> </dd> <dt class="hdlist1"> @@ -1268,7 +1439,7 @@ <dd> <p> Controls the similarity threshold used for rename detection. - See also <a href="git-diff.html">git-diff(1)</a> <tt>-M</tt>. + See also <a href="git-diff.html">git-diff(1)</a> <code>-M</code>. </p> </dd> <dt class="hdlist1"> @@ -1324,6 +1495,8 @@ </dd> </dl></div> </div> +</div> +<div class="sect1"> <h2 id="_notes">NOTES</h2> <div class="sectionbody"> <div class="paragraph"><p>You should understand the implications of using <em>git rebase</em> on a @@ -1335,6 +1508,8 @@ pre-rebase hook script for an example.</p></div> <div class="paragraph"><p>Upon completion, <branch> will be the current branch.</p></div> </div> +</div> +<div class="sect1"> <h2 id="_interactive_mode">INTERACTIVE MODE</h2> <div class="sectionbody"> <div class="paragraph"><p>Rebasing interactively means that you have a chance to edit the commits @@ -1403,7 +1578,7 @@ <div class="paragraph"><p>Start it with the last commit you want to retain as-is:</p></div> <div class="literalblock"> <div class="content"> -<pre><tt>git rebase -i <after-this-commit></tt></pre> +<pre><code>git rebase -i <after-this-commit></code></pre> </div></div> <div class="paragraph"><p>An editor will be fired up with all the commits in your current branch (ignoring merge commits), which come after the given commit. You can @@ -1411,9 +1586,9 @@ remove them. The list looks more or less like this:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>pick deadbee The oneline of this commit +<pre><code>pick deadbee The oneline of this commit pick fa1afe1 The oneline of the next commit -...</tt></pre> +...</code></pre> </div></div> <div class="paragraph"><p>The oneline descriptions are purely for your pleasure; <em>git rebase</em> will not look at them but at the commit names ("deadbee" and "fa1afe1" in this @@ -1433,29 +1608,29 @@ but omits the commit messages of commits with the "fixup" command.</p></div> <div class="paragraph"><p><em>git rebase</em> will stop when "pick" has been replaced with "edit" or when a command fails due to merge errors. When you are done editing -and/or resolving conflicts you can continue with <tt>git rebase --continue</tt>.</p></div> +and/or resolving conflicts you can continue with <code>git rebase --continue</code>.</p></div> <div class="paragraph"><p>For example, if you want to reorder the last 5 commits, such that what was HEAD~4 becomes the new HEAD. To achieve that, you would call <em>git rebase</em> like this:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>$ git rebase -i HEAD~5</tt></pre> +<pre><code>$ git rebase -i HEAD~5</code></pre> </div></div> <div class="paragraph"><p>And move the first patch to the end of the list.</p></div> <div class="paragraph"><p>You might want to preserve merges, if you have a history like this:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> X +<pre><code> X \ A---M---B / ----o---O---P---Q</tt></pre> +---o---O---P---Q</code></pre> </div></div> <div class="paragraph"><p>Suppose you want to rebase the side branch starting at "A" to "Q". Make sure that the current HEAD is "B", and call</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>$ git rebase -i -p --onto Q O</tt></pre> +<pre><code>$ git rebase -i -p --onto Q O</code></pre> </div></div> <div class="paragraph"><p>Reordering and editing commits usually creates untested intermediate steps. You may want to check that your history editing did not break @@ -1464,39 +1639,41 @@ do so by creating a todo list like this one:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>pick deadbee Implement feature XXX +<pre><code>pick deadbee Implement feature XXX fixup f1a5c00 Fix to feature XXX exec make pick c0ffeee The oneline of the next commit edit deadbab The oneline of the commit after exec cd subdir; make test -...</tt></pre> +...</code></pre> </div></div> <div class="paragraph"><p>The interactive rebase will stop when a command fails (i.e. exits with non-0 status) to give you an opportunity to fix the problem. You can -continue with <tt>git rebase --continue</tt>.</p></div> +continue with <code>git rebase --continue</code>.</p></div> <div class="paragraph"><p>The "exec" command launches the command in a shell (the one specified -in <tt>$SHELL</tt>, or the default shell if <tt>$SHELL</tt> is not set), so you can +in <code>$SHELL</code>, or the default shell if <code>$SHELL</code> is not set), so you can use shell features (like "cd", ">", ";" …). The command is run from the root of the working tree.</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>$ git rebase -i --exec "make test"</tt></pre> +<pre><code>$ git rebase -i --exec "make test"</code></pre> </div></div> <div class="paragraph"><p>This command lets you check that intermediate commits are compilable. The todo list becomes like that:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>pick 5928aea one +<pre><code>pick 5928aea one exec make test pick 04d0fda two exec make test pick ba46169 three exec make test pick f4593f9 four -exec make test</tt></pre> +exec make test</code></pre> </div></div> </div> +</div> +<div class="sect1"> <h2 id="_splitting_commits">SPLITTING COMMITS</h2> <div class="sectionbody"> <div class="paragraph"><p>In interactive mode, you can mark commits with the action "edit". However, @@ -1506,7 +1683,7 @@ <div class="ulist"><ul> <li> <p> -Start an interactive rebase with <tt>git rebase -i <commit>^</tt>, where +Start an interactive rebase with <code>git rebase -i <commit>^</code>, where <commit> is the commit you want to split. In fact, any commit range will do, as long as it contains that commit. </p> @@ -1518,7 +1695,7 @@ </li> <li> <p> -When it comes to editing that commit, execute <tt>git reset HEAD^</tt>. The +When it comes to editing that commit, execute <code>git reset HEAD^</code>. The effect is that the HEAD is rewound by one, and the index follows suit. However, the working tree stays the same. </p> @@ -1526,7 +1703,7 @@ <li> <p> Now add the changes to the index that you want to have in the first - commit. You can use <tt>git add</tt> (possibly interactively) or + commit. You can use <code>git add</code> (possibly interactively) or <em>git gui</em> (or both) to do that. </p> </li> @@ -1543,7 +1720,7 @@ </li> <li> <p> -Continue the rebase with <tt>git rebase --continue</tt>. +Continue the rebase with <code>git rebase --continue</code>. </p> </li> </ul></div> @@ -1552,6 +1729,8 @@ <em>git stash</em> to stash away the not-yet-committed changes after each commit, test, and amend the commit if fixes are necessary.</p></div> </div> +</div> +<div class="sect1"> <h2 id="_recovering_from_upstream_rebase">RECOVERING FROM UPSTREAM REBASE</h2> <div class="sectionbody"> <div class="paragraph"><p>Rebasing (or any other form of rewriting) a branch that others have @@ -1565,30 +1744,30 @@ following:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> o---o---o---o---o---o---o---o---o master +<pre><code> o---o---o---o---o---o---o---o---o master \ o---o---o---o---o subsystem \ - *---*---* topic</tt></pre> + *---*---* topic</code></pre> </div></div> <div class="paragraph"><p>If <em>subsystem</em> is rebased against <em>master</em>, the following happens:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> o---o---o---o---o---o---o---o master +<pre><code> o---o---o---o---o---o---o---o master \ \ o---o---o---o---o o'--o'--o'--o'--o' subsystem \ - *---*---* topic</tt></pre> + *---*---* topic</code></pre> </div></div> <div class="paragraph"><p>If you now continue development as usual, and eventually merge <em>topic</em> to <em>subsystem</em>, the commits from <em>subsystem</em> will remain duplicated forever:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> o---o---o---o---o---o---o---o master +<pre><code> o---o---o---o---o---o---o---o master \ \ o---o---o---o---o o'--o'--o'--o'--o'--M subsystem \ / - *---*---*-..........-*--* topic</tt></pre> + *---*---*-..........-*--* topic</code></pre> </div></div> <div class="paragraph"><p>Such duplicates are generally frowned upon because they clutter up history, making it harder to follow. To clean things up, you need to @@ -1612,13 +1791,14 @@ <dd> <p> This happens if the <em>subsystem</em> rebase had conflicts, or used - <tt>--interactive</tt> to omit, edit, squash, or fixup commits; or - if the upstream used one of <tt>commit --amend</tt>, <tt>reset</tt>, or - <tt>filter-branch</tt>. + <code>--interactive</code> to omit, edit, squash, or fixup commits; or + if the upstream used one of <code>commit --amend</code>, <code>reset</code>, or + <code>filter-branch</code>. </p> </dd> </dl></div> -<h3 id="_the_easy_case">The easy case</h3><div style="clear:left"></div> +<div class="sect2"> +<h3 id="_the_easy_case">The easy case</h3> <div class="paragraph"><p>Only works if the changes (patch IDs based on the diff contents) on <em>subsystem</em> are literally the same before and after the rebase <em>subsystem</em> did.</p></div> @@ -1627,18 +1807,20 @@ (assuming you’re on <em>topic</em>)</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> $ git rebase subsystem</tt></pre> +<pre><code> $ git rebase subsystem</code></pre> </div></div> <div class="paragraph"><p>you will end up with the fixed history</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> o---o---o---o---o---o---o---o master +<pre><code> o---o---o---o---o---o---o---o master \ o'--o'--o'--o'--o' subsystem \ - *---*---* topic</tt></pre> + *---*---* topic</code></pre> </div></div> -<h3 id="_the_hard_case">The hard case</h3><div style="clear:left"></div> +</div> +<div class="sect2"> +<h3 id="_the_hard_case">The hard case</h3> <div class="paragraph"><p>Things get more complicated if the <em>subsystem</em> changes do not exactly correspond to the ones before the rebase.</p></div> <div class="admonitionblock"> @@ -1648,8 +1830,8 @@ </td> <td class="content">While an "easy case recovery" sometimes appears to be successful even in the hard case, it may have unintended consequences. For - example, a commit that was removed via <tt>git rebase - --interactive</tt> will be <strong>resurrected</strong>!</td> + example, a commit that was removed via <code>git rebase + --interactive</code> will be <strong>resurrected</strong>!</td> </tr></table> </div> <div class="paragraph"><p>The idea is to manually tell <em>git rebase</em> "where the old <em>subsystem</em> @@ -1660,56 +1842,62 @@ <li> <p> With the <em>subsystem</em> reflog: after <em>git fetch</em>, the old tip of - <em>subsystem</em> is at <tt>subsystem@{1}</tt>. Subsequent fetches will + <em>subsystem</em> is at <code>subsystem@{1}</code>. Subsequent fetches will increase the number. (See <a href="git-reflog.html">git-reflog(1)</a>.) </p> </li> <li> <p> Relative to the tip of <em>topic</em>: knowing that your <em>topic</em> has three - commits, the old tip of <em>subsystem</em> must be <tt>topic~3</tt>. + commits, the old tip of <em>subsystem</em> must be <code>topic~3</code>. </p> </li> </ul></div> -<div class="paragraph"><p>You can then transplant the old <tt>subsystem..topic</tt> to the new tip by +<div class="paragraph"><p>You can then transplant the old <code>subsystem..topic</code> to the new tip by saying (for the reflog case, and assuming you are on <em>topic</em> already):</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> $ git rebase --onto subsystem subsystem@{1}</tt></pre> +<pre><code> $ git rebase --onto subsystem subsystem@{1}</code></pre> </div></div> <div class="paragraph"><p>The ripple effect of a "hard case" recovery is especially bad: <em>everyone</em> downstream from <em>topic</em> will now have to perform a "hard case" recovery too!</p></div> </div> +</div> +</div> +<div class="sect1"> <h2 id="_bugs">BUGS</h2> <div class="sectionbody"> -<div class="paragraph"><p>The todo list presented by <tt>--preserve-merges --interactive</tt> does not +<div class="paragraph"><p>The todo list presented by <code>--preserve-merges --interactive</code> does not represent the topology of the revision graph. Editing commits and rewording their commit messages should work fine, but attempts to reorder commits tend to produce counterintuitive results.</p></div> <div class="paragraph"><p>For example, an attempt to rearrange</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>1 --- 2 --- 3 --- 4 --- 5</tt></pre> +<pre><code>1 --- 2 --- 3 --- 4 --- 5</code></pre> </div></div> <div class="paragraph"><p>to</p></div> <div class="listingblock"> <div class="content"> -<pre><tt>1 --- 2 --- 4 --- 3 --- 5</tt></pre> +<pre><code>1 --- 2 --- 4 --- 3 --- 5</code></pre> </div></div> <div class="paragraph"><p>by moving the "pick 4" line will result in the following history:</p></div> <div class="listingblock"> <div class="content"> -<pre><tt> 3 +<pre><code> 3 / -1 --- 2 --- 4 --- 5</tt></pre> +1 --- 2 --- 4 --- 5</code></pre> </div></div> </div> +</div> +<div class="sect1"> <h2 id="_git">GIT</h2> <div class="sectionbody"> <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> </div> </div> +</div> <div id="footnotes"><hr /></div> <div id="footer"> <div id="footer-text">